package com.example.vo;

import lombok.*;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class RespBean {

    private long code;
    private String message;
    private Object obj;

    //成功的返回结果
    public static RespBean success() {
        return new RespBean(RespBeanEnum.Success.getCode(), RespBeanEnum.Success.getMessage(), null);
    }

    //成功的返回结果
    public static RespBean success(Object object) {
        return new RespBean(RespBeanEnum.Success.getCode(), RespBeanEnum.Success.getMessage(), object);

    }

    //失败的返回结果
    public static RespBean error(RespBeanEnum respBeanEnum) {
        return new RespBean(respBeanEnum.getCode(), respBeanEnum.getMessage(), null);

    }
//失败的返回结果

    public static RespBean error(RespBeanEnum respBeanEnum, Object obj) {
        return new RespBean(respBeanEnum.getCode(), respBeanEnum.getMessage(), obj);

    }

}
